Prevent poisonous foods from softlocking the game #3183
Merged
+26
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Bugfixes "Add UNSAFE_CONSUME to several foods that triggered query on eat, to prevent them from softlocking when placed in an auto-eat zone"
Purpose of change
Viss pointed out to me that if an item in an auto-eat zone has a poison use action or other thing that prompts you about if you want to eat them, but lacks the
UNSAFE_CONSUME
flag, you'll be trapped in an infinite loop should it decide to eat that item, where your only options are to either succumb to peer pressure and eat eat morel mushrooms, or to force-quit the game.I figured fix all potential cases of this in the JSON for a quick fix to potential softlocks now, and look at the code to make it stop doing that in a separate PR.
Describe the solution
UNSAFE_CONSUME
flag to morel mushrooms.UNSAFE_CONSUME
to the seed abstract, so that all seeds inheriting from it will be skipped over too. This is because the prompt for comestibles withseed_data
triggers this same issue.BLECH
use action.POISON
use action. Testing confirmed these should be skipped over due to not bein fun to eat, but better safe than sorry due to the softlock potential. Plus, dehydrated tainted meat DOES trigger the softlock due to being above -5 fun, and it inherits from this so.extend
the flag onto its flag list, since it inherits from plant marrow. Confirmed by testing that it can trigger the softlock without this.Describe alternatives you've considered
Focusing on hunting down all the obscure code interactions behind the root problem and fixing them first but weh.
Testing
Checked affected files for syntax and lint errors.
I also tested a few of the odd cases as mentioned above, in particular garlic cloves are technically safe for reasons I'm not sure of without source-diving to find exactly why the seed prompt triggers. Better off doing so since plantable seeds are generally better off saved anyway, and cloves still count as seeds.
Additional context
So I was gonna test if this was still a problem in DDA but on the build I tried (2023-08-10-1558) auto-eat zones just don't even work at all, I tested waiting around with some jerky in it too and the character wouldn't eat that either, even after confirming that they weren't freezing.